#include "RobotMoveCommand.h"

RobotMoveCommand::RobotMoveCommand(Robot* receiver, const Direction& direction): robot(receiver), moveDirection(direction)
{
}

RobotMoveCommand::RobotMoveCommand(const RobotMoveCommand& rhs): GameCommand(rhs), robot(rhs.robot), moveDirection(rhs.moveDirection)
{
}

RobotMoveCommand::~RobotMoveCommand()
{
}

void RobotMoveCommand::Execute()
{
	if (robot)
	{
		switch(moveDirection.Type())
		{
			case Direction::NORTH:
				robot->MoveUp();
			break;
			case Direction::WEST:
				robot->MoveLeft();
			break;
			case Direction::SOUTH:
				robot->MoveDown();
			break;
			case Direction::EAST:
				robot->MoveRight();
			break;
		}
	}
}

GameCommand* RobotMoveCommand::Clone() const
{
	return new RobotMoveCommand(*this);
}
